<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<jsp:include page="include/directive.jsp"></jsp:include>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link href="css/Style002.css" rel="stylesheet" type="text/css" />
		<title>DVD情報一覧</title>
		<script type="text/javascript" src="js/common.js"></script>
		<script type="text/javascript" src="js/GDJK001JS.js"></script>
		<script language="javascript" type="text/javascript">
		<c:if test="${loginState!=null}">
		function showOperation(obj){
			var num = obj.substring(3);
			document.getElementById("ope"+num).style.display="block"
		}
		function hiddenOperation(obj){
			var num = obj.substring(3);
			document.getElementById("ope"+num).style.display="none"
		}
		</c:if>
	</script>
	</head>
	<body>
		<jsp:include page="include/header.jsp"></jsp:include>
		<div id="main">
			<jsp:include page="include/left.jsp"></jsp:include>
			<div id="right">
				<div id="up" style="height:450px;">
				<c:set var="dvdIndex" value="0"></c:set>
				<c:forEach items="${requestScope.List_TDvd}" var="TDvd">
					
					<c:if test ="${dvdIndex % 5 ==0}">
						<div class="line">
					</c:if>
    				<div class="cell">
    					<div id="img${dvdIndex}" class="context" onmouseover="showOperation(this.id);" onmouseout="hiddenOperation(this.id);">
	    					<a href="GDJC001.do?dvdId=${TDvd.FDvdId}"><img src="${TDvd.FImgPath}" /></a>
	    					<caption><a href="GDJC001.do?dvdId=${TDvd.FDvdId}">${TDvd.FDvdTitle}</a></caption>
    					</div>
    					<c:if test="${loginState!=null}">
    					<div id="ope${dvdIndex}" class="operation" onmouseover="this.style.display='block';" onmouseout="this.style.display='none';">
    						<a href="GDJC002.do?dvdId=${TDvd.FDvdId}&action=edit"><img src="images/edit.jpg" /></a>
    						<a href="#" onclick="onDelete('${TDvd.FDvdId}')"><img src="images/delete.jpg" /></a>
     					</div>
     					</c:if>
    				</div>
    				<c:if test ="${(dvdIndex+1) % 5 ==0}">
						<% out.println("</div>");%>
					</c:if>
					<c:set var="dvdIndex" value="${dvdIndex+1}"></c:set>
				</c:forEach>
				<c:if test ="${(dvdIndex) % 5 !=0}">
					<% out.println("</div>");%>
				</c:if>
				</div><!-- end of up -->
				<div class="footer">
					<%-- when search --%>
					<c:if test="${param.pageCount == '-1'}">
						<a href="GDJK001.do?pageId=1">返回</a>
					</c:if>
					<c:if test="${dvdIndex ==0}">
						<script type="text/javascript">
							alert("Aha! NO Result!!");
						</script>
					</c:if>

					<c:if test="${dvdIndex >15}">
						<script type="text/javascript">
							alert("This search contains too many results...");
						</script>
					</c:if>
					<c:if test="${param.pageCount != '-1'}">
					<a href="GDJK001.do?pageId=1">最初頁</a>&nbsp;｜
					<c:forEach var="page" begin="1" end="${param.pageCount}" step="1">	
						<a href="GDJK001.do?pageId=${page}">${page}</a>
					</c:forEach>
					｜&nbsp;<a href="GDJK001.do?pageId=${param.pageCount}">最後頁</a>
					</c:if>
				</div>
			</div>
		</div>
		<jsp:include page="include/footer.jsp" />
	</body>
</html>

